/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>Project: app2022 - ReExp5
 * <p>Powered by webrx On 2022-01-13 16:57:22
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class ReExp5 {
    public static void main(String[] args) {
        String s = "<div>myok,java-1000</div><p>java</p><div>hello,java</div>";

        System.out.println(s);
        System.out.println(s.replaceAll("(<div>.*?)java(.*?</div>)","$1java17$2"));

        //将div标签中的java修改为java17
        Pattern p = Pattern.compile("(<div>.*?)java(.*?</div>)");
        Matcher m = p.matcher(s);
        while(m.find()){
            System.out.println(m.group());
        }



    }
}
